package com.yungu.swift.system.sys.service.impl;

import com.alicp.jetcache.anno.Cached;
import com.yungu.swift.base.ResponseData;
import com.yungu.swift.base.mapper.IMapper;
import com.yungu.swift.base.service.impl.BaseServiceImpl;
import com.yungu.swift.system.sys.dao.SysAssignConfigMapper;
import com.yungu.swift.system.sys.model.dto.SysAssignConfigDto;
import com.yungu.swift.system.sys.service.SysAssignConfigService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

/**
 *
 */
@Service
public class SysAssignConfigServiceImpl extends BaseServiceImpl<SysAssignConfigDto> implements SysAssignConfigService {

    @Autowired
    private SysAssignConfigMapper sysAssignConfigMapper;

    @Override
    protected IMapper<SysAssignConfigDto> getMapper() {
        return sysAssignConfigMapper;
    }


    @Cached(name = "jetCache:system:getAssignConfig:",expire = 60)
    @Override
    public ResponseData<SysAssignConfigDto> get(Map<String, Object> paramMap) {
        List<SysAssignConfigDto> list = this.getMapper().list(paramMap);
        if (list.size() > 0) {
            return ResponseData.buildSuccessResponse(list.get(0));
        }
        return ResponseData.buildErrorResponse(ResponseData.ERROR_CODE, "查询失败");
    }
}